﻿//  Copyright (c) 2011 Ray Liang (http://www.dotnetage.com)
//  Licensed MIT: http://www.opensource.org/licenses/mit-license.php

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DNA.Mvc;

namespace DNA.Mvc.Publishing
{
    public interface ICategoryRepository:IRepository<Category>
    {
        /// <summary>
        /// Get all descendant categories by specified category id.
        /// </summary>
        /// <param name="categoryID">Specified the category id</param>
        /// <returns>A collection contains the descendant categories.</returns>
        IQueryable<Category> Descendants(int categoryID);

        /// <summary>
        /// Get children categories by specified category id.
        /// </summary>
        /// <param name="categoryID">Specified the category id</param>
        /// <returns>A collection contains the children categories.</returns>
        IQueryable<Category> Children(int categoryID);

        /// <summary>
        /// Find the category by specified the path.
        /// </summary>
        /// <param name="path">The category path.</param>
        /// <returns>The category instance.</returns>
        Category Find(string path);

        /// <summary>
        /// Gets the category collection in specified id array.
        /// </summary>
        /// <param name="ids">The category id array.</param>
        /// <returns>The Category collection.</returns>
        IQueryable<Category> Includes(int[] ids);

        /// <summary>
        /// Gets a archive collection by specified category id .
        /// </summary>
        /// <param name="categoryID">The category id .</param>
        /// <returns></returns>
        IQueryable<Archive> GetArchives(string website);

        /// <summary>
        /// Gets the category children count
        /// </summary>
        /// <param name="categoryID">Specified the category id.</param>
        /// <returns>Total children category count</returns>
        int GetChildrenCount(int categoryID);

        /// <summary>
        /// Gets the descendant articles count
        /// </summary>
        /// <param name="categoryID">Specified the category id</param>
        /// <returns></returns>
        int GetDescendantArticleCount(int categoryID);

        /// <summary>
        /// Move the category to a new position.
        /// </summary>
        /// <param name="parentID">Specified the parent category id to move to.</param>
        /// <param name="id">Specified the category id to be move.</param>
        /// <param name="pos">Specified the new position to move to.</param>
        void Move(int parentID, int id, int pos);

        /// <summary>
        ///  Gets the Tag collection by specified category id and return the tags count.
        /// </summary>
        /// <param name="categoryID">The category id.</param>
        /// <param name="count">The tag count.</param>
        /// <returns></returns>
        IQueryable<Tag> GetTags(string website, out int count);
    }
}
